import React, { useEffect } from 'react'
import { Divider, Descriptions } from 'antd'
import styles from './loading.less'
import loadingImg from '@/assets/loading.png'

const TanChaReport = props => {
  if (!props.tanchaData?.resp_data)
    return (
      <div className={styles.loading}>
        <img src={loadingImg} />
      </div>
    )

  const response = props?.tanchaData
  const {
    resp_data: {
      apply_report_detail: applyReport,
      behavior_report_detail: behaviorReport,
      current_report_detail: currentReport
    }
  } = response

  useEffect(() => {
    console.log('TanChaReport')
  }, [])

  return (
    <>
      <Divider>申请行为详情：</Divider>
      <Descriptions bordered layout="vertical" column={4}>
        <Descriptions.Item label="申请命中机构数">
          {applyReport.A22160003}
        </Descriptions.Item>
        <Descriptions.Item label="申请命中消金类机构数">
          {applyReport.A22160004}
        </Descriptions.Item>
        <Descriptions.Item label="申请命中网络贷款类机构数">
          {applyReport.A22160005}
        </Descriptions.Item>
        <Descriptions.Item label="机构总查询次数">
          {applyReport.A22160006}
        </Descriptions.Item>
        <Descriptions.Item label="最近一次查询时间">
          {applyReport.A22160007}
        </Descriptions.Item>
        <Descriptions.Item label="近1个月机构总查询笔数">
          {applyReport.A22160008}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月机构总查询笔数">
          {applyReport.A22160009}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月机构总查询笔数">
          {applyReport.A22160010}
        </Descriptions.Item>
      </Descriptions>

      <Divider>放款还款详情：</Divider>
      <Descriptions bordered layout="vertical" column={5}>
        <Descriptions.Item label="近1个月贷款笔数">
          {behaviorReport.B22170002}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月贷款笔数">
          {behaviorReport.B22170003}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月贷款笔数">
          {behaviorReport.B22170004}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月贷款笔数">
          {behaviorReport.B22170005}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月贷款笔数">
          {behaviorReport.B22170006}
        </Descriptions.Item>
        <Descriptions.Item label="近1个月贷款机构数">
          {behaviorReport.B22170016}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月贷款机构数">
          {behaviorReport.B22170017}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月贷款机构数">
          {behaviorReport.B22170018}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月贷款机构数">
          {behaviorReport.B22170019}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月贷款机构数">
          {behaviorReport.B22170020}
        </Descriptions.Item>
      </Descriptions>

      <Descriptions
        style={{ marginTop: 20 }}
        bordered
        layout="vertical"
        column={4}
      >
        <Descriptions.Item label="近12个月消金类贷款机构数">
          {behaviorReport.B22170021}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月消金类贷款机构数">
          {behaviorReport.B22170022}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月网贷类贷款机构数">
          {behaviorReport.B22170023}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月网贷类贷款机构数">
          {behaviorReport.B22170024}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月累计逾期金额">
          {behaviorReport.B22170031}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月累计逾期金额">
          {behaviorReport.B22170032}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月累计逾期金额">
          {behaviorReport.B22170033}
        </Descriptions.Item>
        <Descriptions.Item label="正常还款订单数占贷款总订单数比例">
          {behaviorReport.B22170034}
        </Descriptions.Item>
      </Descriptions>

      <Descriptions
        style={{ marginTop: 20 }}
        bordered
        layout="vertical"
        column={5}
      >
        <Descriptions.Item label="近1个月失败扣款笔数">
          {behaviorReport.B22170035}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月失败扣款笔数">
          {behaviorReport.B22170036}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月失败扣款笔数">
          {behaviorReport.B22170037}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月失败扣款笔数">
          {behaviorReport.B22170038}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月失败扣款笔数">
          {behaviorReport.B22170039}
        </Descriptions.Item>
        <Descriptions.Item label="近1个月履约贷款总金额">
          {behaviorReport.B22170040}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月履约贷款总金额">
          {behaviorReport.B22170041}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月履约贷款总金额">
          {behaviorReport.B22170042}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月履约贷款总金额">
          {behaviorReport.B22170043}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月履约贷款总金额">
          {behaviorReport.B22170044}
        </Descriptions.Item>
      </Descriptions>

      <Descriptions
        style={{ marginTop: 20 }}
        bordered
        layout="vertical"
        column={6}
      >
        <Descriptions.Item label="近1个月履约贷款次数">
          {behaviorReport.B22170045}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月履约贷款次数">
          {behaviorReport.B22170046}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月履约贷款次数">
          {behaviorReport.B22170047}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月履约贷款次数">
          {behaviorReport.B22170048}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月履约贷款次数">
          {behaviorReport.B22170049}
        </Descriptions.Item>
        <Descriptions.Item label="最近一次履约距今天数">
          {behaviorReport.B22170050}
        </Descriptions.Item>
      </Descriptions>

      <Descriptions
        style={{ marginTop: 20 }}
        bordered
        layout="vertical"
        column={3}
      >
        <Descriptions.Item label="贷款已结清订单数">
          {behaviorReport.B22170052}
        </Descriptions.Item>
        <Descriptions.Item label="信用贷款时长">
          {behaviorReport.B22170053}
        </Descriptions.Item>
        <Descriptions.Item label="最近一次贷款放款时间">
          {behaviorReport.B22170054}
        </Descriptions.Item>
      </Descriptions>

      <Divider>信用详情：</Divider>
      <Descriptions bordered layout="vertical" column={3}>
        <Descriptions.Item label="网络贷款类机构数">
          {currentReport.C22180003}
        </Descriptions.Item>
        <Descriptions.Item label="网络贷款机构最大授信额度">
          {currentReport.C22180005}
        </Descriptions.Item>
        <Descriptions.Item label="网络贷款机构平均授信额度">
          {currentReport.C22180006}
        </Descriptions.Item>
        <Descriptions.Item label="消金贷款类机构数">
          {currentReport.C22180007}
        </Descriptions.Item>
        <Descriptions.Item label="消金贷款类机构最大授信额度">
          {currentReport.C22180009}
        </Descriptions.Item>
        <Descriptions.Item label="消金贷款类机构平均授信额度">
          {currentReport.C22180010}
        </Descriptions.Item>
      </Descriptions>
    </>
  )
}

export default TanChaReport
